package com.ehotting.edsta.circuitDesign.enums;

public enum DataTypeEnum implements BaseEnum {

    INTEGER(0,"Integer","整数型"),
    LONG(1,"Long","长整数型"),
    FLOAT(2,"Float","浮点型"),
    DOUBLE(3,"Double","双精度浮点型"),
    STRING(4,"String","字符型"),
    BOOLEAN(5,"Boolean","布尔型"),
    OBJECT(6,"Map","对象");

    private Integer value;
    private String code;
    private String name;

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    DataTypeEnum(Integer value, String code, String name) {
        this.value = value;
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static DataTypeEnum getObject(Integer value){
        DataTypeEnum[] rules = DataTypeEnum.values();
        for(DataTypeEnum rule : rules){
            if(rule.getValue().equals(value)){
                return rule;
            }
        }
        return DataTypeEnum.INTEGER;
    }

}
